﻿using System;
using UnityEngine;

namespace RootMotion.Demos
{
	// Token: 0x020000AF RID: 175
	public class MotionAbsorbCharacter : MonoBehaviour
	{
		// Token: 0x06000597 RID: 1431 RVA: 0x00005973 File Offset: 0x00003B73
		public void Start()
		{
			this.cubeDefaultPosition = this.cube.position;
			this.cubeRigidbody = this.cube.GetComponent<Rigidbody>();
		}

		// Token: 0x06000598 RID: 1432 RVA: 0x00036188 File Offset: 0x00034388
		public void Update()
		{
			this.info = this.animator.GetCurrentAnimatorStateInfo(0);
			this.motionAbsorb.weight = this.motionAbsorbWeight.Evaluate(this.info.normalizedTime - (float)((int)this.info.normalizedTime));
		}

		// Token: 0x06000599 RID: 1433 RVA: 0x000361D8 File Offset: 0x000343D8
		public void SwingStart()
		{
			this.cubeRigidbody.MovePosition(this.cubeDefaultPosition + UnityEngine.Random.insideUnitSphere * this.cubeRandomPosition);
			this.cubeRigidbody.MoveRotation(Quaternion.identity);
			this.cubeRigidbody.velocity = Vector3.zero;
			this.cubeRigidbody.angularVelocity = Vector3.zero;
		}

		// Token: 0x04000498 RID: 1176
		public Animator animator;

		// Token: 0x04000499 RID: 1177
		public MotionAbsorb motionAbsorb;

		// Token: 0x0400049A RID: 1178
		public Transform cube;

		// Token: 0x0400049B RID: 1179
		public float cubeRandomPosition = 0.1f;

		// Token: 0x0400049C RID: 1180
		public AnimationCurve motionAbsorbWeight;

		// Token: 0x0400049D RID: 1181
		public Vector3 cubeDefaultPosition;

		// Token: 0x0400049E RID: 1182
		public AnimatorStateInfo info;

		// Token: 0x0400049F RID: 1183
		public Rigidbody cubeRigidbody;
	}
}
